<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Set循环</title>
    <script>
        let setArr = new Set(['a', 'b', 'c', 'd']);

        for (let item of setArr.keys()) {
            console.log(item);
        }
        console.log('--------------------------------------');

        for (let item of setArr.values()) {
            console.log(item);
        }
        console.log('--------------------------------------');

        for (let item of setArr.entries()) {
            console.log(item);
        }
        console.log('--------------------------------------');

        for (let [k, v] of setArr.entries()) {
            console.log(k, v);
        }
        console.log('--------------------------------------');

        setArr.forEach((value, index) => {
            console.log(value, index);
        })
    </script>
</head>

<body>

</body>

</html>